with open('all.txt','r',encoding='utf8')as f:
    all_d=f.read().split('\n')

dic_all={x.split('  ')[1].split('.')[0]:x.split('  ')[0] for x in all_d if x!=''}

with open('dogs.txt','r',encoding='utf8')as f:
    dogs_d=f.read().split('\n')

dic_dog=[x.split('  ')[0] for x in dogs_d if x!='']

keyss=sorted([int(x) for x in list(dic_all.keys())])
print(keyss)
r=''
for x in keyss:
    x=str(x)
    if dic_all[x] in dic_dog:
        r=r+'1'
    else:
        r=r+'0'
print(r)